<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a="http://richfaces.org/a4j" xmlns:r="http://richfaces.org/rich"
	xmlns:t="http://myfaces.apache.org/tomahawk" template="/template.xhtml">
	<ui:define name="title">Создание шаблона</ui:define>
	<ui:define name="body">
		<h:form>
			Название:<br />
			<h:inputText value="#{editTemplate.name}" />
			<br />
			<r:panel id="attributeList">
				<f:facet name="header">
					<h:outputText value="Атрибуты" />
				</f:facet>
				<ui:repeat value="#{editTemplate.attributeList}" var="a">
					<h:outputText value="#{a.name}" />
					<br />
				</ui:repeat>
			</r:panel>
			<r:modalPanel id="editAttributeForm" minHeight="200" minWidth="450"
				height="200" width="500">
				<f:facet name="header">
					<h:outputText value="Создание атрибута" />
				</f:facet>
				<f:facet name="controls">
				</f:facet>
				Название:<br />
				<h:inputText value="#{editAttribute.name}" />
				<br />
				<a:commandButton
					onclick="#{r:component('editAttributeForm')}.hide()"
					action="#{editTemplateController.create(editAttribute)}"
					reRender="attributeList" value="Закрыть" />
			</r:modalPanel>
			<a:commandButton value="Добавить атрибут"
				onclick="#{r:component('editAttributeForm')}.show()" />
			<br />
			<h:commandButton
				action="#{editTemplateController.create(editTemplate)}"
				value="Сохранить" />
		</h:form>
	</ui:define>
</ui:composition>